﻿using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Configuration;

namespace ERP.UI.SystemAdministrator
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            this.InitializeComponent();
            // Insert code required on object creation below this point.
            //Set UI culture
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(
                ERP.Framework.Components.ConfigurationHelper.ConfigurationManager.UserInterfaceSettings.CurrentUICulture
                );
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ERP.UI.SystemAdministrator.Login frmLogin = new ERP.UI.SystemAdministrator.Login();
            if (!(bool)frmLogin.ShowDialog())
                Close();
            else
            {
                sbiCurrentUser.Content = string.Format("Current User : {0}", ApplicationVariables.CurrentUser.Username);
            }
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            LoginSettings frm = new LoginSettings();
            frm.ShowDialog();
        }

        private void MenuItem_Company_Click(object sender, RoutedEventArgs e)
        {
            CompanyInformation ci = new CompanyInformation();
            ci.ShowDialog();
        }

        private void sbiCurrentUser_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            MenuItem_Click(new object(), new RoutedEventArgs());
        }
    }
}